Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defer worker creation #171

Merged
merged 1 commit into from
Jan 26, 2022
Merged

Conversation

liamcmitchell-sc
Copy link
Contributor

Fixes #112, #131

Worker creation can be deferred until needed. This wraps the default export and reset functions, only creating the default fire function when needed. Same API as before, could be released as a patch.

An alternative is to move worker init into the fire function:

function fire(options) {
  if (worker === undefined) {
    worker = shouldUseWorker ? getWorker() : null;
  }

This might be cleaner than the shim but would probably be more invasive so I didn't go there.

@catdad
Copy link
Owner

catdad commented Jan 26, 2022

I can't think of why not, let's do it!

@catdad catdad merged commit 3d040ef into catdad:master Jan 26, 2022
@liamcmitchell-sc liamcmitchell-sc deleted the defer-default branch January 27, 2022 07:30
@liamcmitchell-sc
Copy link
Contributor Author

@catdad thanks, when will this be released?

@catdad
Copy link
Owner

catdad commented Feb 7, 2022

Sorry this took a minute. I wanted to publish this right away, but had some issues with CI (thanks travis). It's out now in 1.5.0.

@liamcmitchell-sc
Copy link
Contributor Author

Thanks, appreciate it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Errors immediately when loaded in a sandboxed iframe
2 participants